<?php

class PDOConfig extends PDO {
	private $DSN='mysql:host=localhost;dbname=config';
	private $USER='conf';
	private $PASSWORD='conf';
	private $APPLI;
	private $VERSION;
	private $RELEASE;
	private $sth;
	public function __construct( $appli, $version, $release) {
		parent::__construct($this->DSN, $this->USER, $this->PASSWORD);
		$this->APPLI=$appli;
		$this->VERSION=$version;
		$this->RELEASE=$release;
		
		$REQ="SELECT VALEUR FROM configuration WHERE APPLICATION=\"";
		$REQ.=$this->APPLI;
		$REQ.="\" AND VERSION=\"";
		$REQ.=$this->VERSION;
		$REQ.="\" AND `RELEASE`=\"";
		$REQ.=$this->RELEASE;
		$REQ.="\" AND SECTION=? AND PARAMETRE=?";
		$this->sth = $this->prepare($REQ);
	}
	
	public function get($section, $parametre) {
		$this->sth->execute(array($section, $parametre));
		return $this->sth->fetchColumn();
		
		
	}
}


$cfg=new PDOConfig("cms", "1.0", "1");
echo $cfg->get("default", "titre");
?>